#include <func.h>
int p0;
int p1;
int p2;
int p3;
void sigFunc(int num)
{
kill(p0,9);
kill(p1,9);
kill(p2,9);
kill(p3,9);


}
int main (int argc,char* argv[])
{
   //创建一片共享内存；
   int shmid=shmget(1000,4096,IPC_CREAT|0600);
 ERROR_CHECK(shmid,-1,"shmget");
 int *pid = (int *)shmat(shmid, NULL, 0);
    ERROR_CHECK(pid, (void *)-1, "shmat");
    pid[3] = getpid();
   printf("pid=%d\n",pid[3]);
  
   // while (pid[0] == 0 || pid[1] == 0 || pid[2] == 0 || pid[3] == 0)
   // {
   // }
 p0 = pid[0];
    p1= pid[1];
    p2 = pid[2];
    p3 = pid[3];
    signal(SIGUSR1,sigFunc);
    while(1)
    {
      printf("欧克\n");
      if(pid[4]=='1')//检查消息类型；
      {
         printf("B say:%ls",pid+1);
      }
    }
    return 0;
}